package mil.af.amc.adpetracker.web.decorators;

import mil.af.amc.adpetracker.model.AdpeAccount;
import mil.af.amc.adpetracker.util.LinkBuilder;
import org.displaytag.decorator.TableDecorator;

/**
 * Please fill in this Javadoc
 *
 * @author Jason Ferguson
 */
public class AdpeAccountDecorator extends TableDecorator {

    public String getId() {

        AdpeAccount aa = (AdpeAccount) getCurrentRowObject();
        return Integer.toString(aa.getId());
    }

    public String getDraName() {
        AdpeAccount aa = (AdpeAccount) getCurrentRowObject();
        return aa.getDra().getName();
    }

    public String getAccountName() {
        AdpeAccount aa = (AdpeAccount) getCurrentRowObject();
        return aa.getName();
    }

    public int getAccountItemCount() {
        AdpeAccount aa = (AdpeAccount) getCurrentRowObject();
        return aa.getAccountInventory().size();
    }

    public String getAccountProfileActions() {

        StringBuffer sb = new StringBuffer();
        sb.append("Edit Delete");
        return sb.toString();
    }

    public String getDraDetailActions() {

        AdpeAccount aa = (AdpeAccount) getCurrentRowObject();

        LinkBuilder deleteLink = new LinkBuilder();
        deleteLink.setName("Delete");
        deleteLink.setBaseUrl("adpeAccountAction.do");
        deleteLink.addParameter("method","deleteAdpeAccount");
        deleteLink.addParameter("adpeAccountId", aa.getId());

        return deleteLink.getLink(LinkBuilder.LINK_TEXT, true);
    }
}
